/**
 * Conway's Game of Life
 * A "cellular automaton" zero-player mathematical game.
 *
 * Author: Leo Deng
 * URL:    https://github.com/myst729/game-of-life
 */

// Preset lifes.
var lifes = [
  {
    name: '',
    matrix: []
  },
  {
    name: "Game of Life",
    matrix: [
      // C
      '56|46', '56|47', '56|48', '56|49', '57|45', '58|45', '59|45', '60|45', '61|45', '62|46', '62|47', '62|48', '62|49',
      // o
      '58|52', '58|53', '58|54', '59|51', '59|55', '60|51', '60|55', '61|51', '61|55', '62|52', '62|53', '62|54',
      // n
      '58|57', '58|58', '58|59', '58|60', '59|57', '59|61', '60|57', '60|61', '61|57', '61|61', '62|57', '62|61',
      // w
      '58|63', '58|66', '58|69', '59|63', '59|66', '59|69', '60|63', '60|66', '60|69', '61|63', '61|66', '61|69', '62|64', '62|65', '62|67', '62|68',
      // a
      '58|72', '58|73', '58|74', '59|75', '60|72', '60|73', '60|74', '60|75', '61|71', '61|75', '62|71', '62|72', '62|73', '62|74', '62|75',
      // y
      '58|77', '58|81', '59|77', '59|81', '60|77', '60|81', '61|77', '61|81', '62|78', '62|79', '62|80', '62|81', '63|81', '64|78', '64|79', '64|80',
      // '
      '56|83', '57|83',
      // s
      '58|86', '58|87', '58|88', '58|89', '59|85', '60|86', '60|87', '60|88', '61|89', '62|85', '62|86', '62|87', '62|88',
      // G
      '56|95', '56|96', '56|97', '56|98', '57|94', '58|94', '59|94', '59|96', '59|97', '59|98', '60|94', '60|98', '61|94', '61|98', '62|95', '62|96', '62|97', '62|98',
      // a
      '58|101', '58|102', '58|103', '59|104', '60|101', '60|102', '60|103', '60|104', '61|100', '61|104', '62|100', '62|101', '62|102', '62|103', '62|104',
      // m
      '58|106', '58|107', '58|108', '58|109', '58|110', '58|111', '59|106', '59|109', '59|112', '60|106', '60|109', '60|112', '61|106', '61|109', '61|112', '62|106', '62|109', '62|112',
      // e
      '58|115', '58|116', '58|117', '59|114', '59|118', '60|114', '60|115', '60|116', '60|117', '60|118', '61|114', '62|115', '62|116', '62|117', '62|118',
      // o
      '58|124', '58|125', '58|126', '59|123', '59|127', '60|123', '60|127', '61|123', '61|127', '62|124', '62|125', '62|126',
      // f
      '56|131', '56|132', '56|133', '57|130', '58|130', '59|129', '59|130', '59|131', '59|132', '59|133', '60|130', '61|130', '62|130',
      // L
      '56|138', '57|138', '58|138', '59|138', '60|138', '61|138', '62|139', '62|140', '62|141', '62|142',
      // i
      '57|144', '59|144', '60|144', '61|144', '62|144',
      // f
      '56|148', '56|149', '56|150', '57|147', '58|147', '59|146', '59|147', '59|148', '59|149', '59|150', '60|147', '61|147', '62|147',
      // e
      '58|153', '58|154', '58|155', '59|152', '59|156', '60|152', '60|153', '60|154', '60|155', '60|156', '61|152', '62|153', '62|154', '62|155', '62|156'
    ]
  },
  {
    name: "Still Lifes",
    matrix: [
      // block
      '30|40', '30|41', '31|40', '31|41',
      // beehive
      '30|80', '30|81', '31|79', '31|82', '32|80', '32|81',
      // loaf
      '70|41', '70|42', '71|40', '71|43', '72|41', '72|43', '73|42',
      // boat
      '70|80', '70|81', '71|80', '71|82', '72|81'
    ]
  },
  {
    name: "Small Exploder",
    matrix: ['50|51', '51|50', '51|51', '51|52', '52|50', '52|52', '53|51']
  },
  {
    name: "High Life",
    matrix: [
      // one
      '50|80', '50|81', '50|82', '51|79', '51|82', '52|78', '52|82', '53|78', '53|81', '54|78', '54|79', '54|80',
      // two
      '54|84', '54|85', '54|86', '55|83', '55|86', '56|82', '56|86', '57|82', '57|85', '58|82', '58|83', '58|84',
      // three
      '58|88', '58|89', '58|90', '59|87', '59|90', '60|86', '60|90', '61|86', '61|89', '62|86', '62|87', '62|88',
      // four
      '62|92', '62|93', '62|94', '63|91', '63|94', '64|90', '64|94', '65|90', '65|93', '66|90', '66|91', '66|92'
    ]
  },
  {
    name: "Oscillators",
    matrix: [
      // blinker (period 2)
      '30|40', '30|41', '30|42',
      // toad (period 2)
      '30|81', '30|82', '30|83', '31|80', '31|81', '31|82',
      // beacon (period 2)
      '30|120', '30|121', '31|120', '32|123', '33|122', '33|123',
      // pulsar (period 3)
      '70|42', '70|43', '70|44', '70|48', '70|49', '70|50',
      '72|40', '72|45', '72|47', '72|52',
      '73|40', '73|45', '73|47', '73|52',
      '74|40', '74|45', '74|47', '74|52',
      '75|42', '75|43', '75|44', '75|48', '75|49', '75|50',
      '77|42', '77|43', '77|44', '77|48', '77|49', '77|50',
      '78|40', '78|45', '78|47', '78|52',
      '79|40', '79|45', '79|47', '79|52',
      '80|40', '80|45', '80|47', '80|52',
      '82|42', '82|43', '82|44', '82|48', '82|49', '82|50',
      // tumbler
      '70|91', '70|95',
      '71|90', '71|91', '71|95', '71|96',
      '72|90', '72|92', '72|94', '72|96',
      '73|92', '73|94',
      '74|91', '74|92', '74|94', '74|95',
      '75|91', '75|95'
    ]
  },
  {
    name: "Exploder",
    matrix: ['50|50', '50|52', '50|54', '51|50', '51|54', '52|50', '52|54', '53|50', '53|54', '54|50', '54|52', '54|54']
  },
  {
    name: "10 Cell Row",
    matrix: ['50|50', '50|51', '50|52', '50|53', '50|54', '50|55', '50|56', '50|57', '50|58', '50|59']
  },
  {
    name: "Little Flower",
    matrix: ['48|51', '50|50', '50|51', '50|52']
  },
  {
    name: "Glider",
    matrix: ['30|31', '31|32', '32|30', '32|31', '32|32']
  },
  {
    name: "Lightweight Spaceship",
    matrix: ['50|31', '50|32', '50|33', '50|34', '51|30', '51|34', '52|34', '53|30', '53|33']
  },
  {
    name: "The R-pentomino",
    matrix: ['54|90', '54|91', '55|89', '55|90', '56|90']
  },
  {
    name: "Die Hard",
    matrix: ['39|66', '40|60', '40|61', '41|61', '41|65', '41|66', '41|67']
  },
  {
    name: "Acron",
    matrix: ['54|90', '55|92', '56|89', '56|90', '56|92', '56|93', '56|94']
  },
  {
    name: "Gosper's Glider Gun",
    matrix: [
      '30|64',
      '31|62', '31|64',
      '32|52', '32|53', '32|60', '32|61', '32|74', '32|75',
      '33|51', '33|55', '33|60', '33|61', '33|74', '33|75',
      '34|40', '34|41', '34|50', '34|56', '34|60', '34|61',
      '35|40', '35|41', '35|50', '35|54', '35|56', '35|57', '35|62', '35|64',
      '36|50', '36|56', '36|64',
      '37|51', '37|55',
      '38|52', '38|53'
    ]
  },
  {
    name: "Infinite A",
    matrix: ['50|90', '51|88', '51|90', '51|91', '52|88', '52|90', '53|88', '54|86', '55|84', '55|86']
  },
  {
    name: "Infinite B",
    matrix: ['50|90', '50|91', '50|92', '50|94', '51|90', '52|93', '52|94', '53|91', '53|92', '53|94', '54|90', '54|92', '54|94']
  },
  {
    name: "Infinite C",
    matrix: [
      '50|80', '50|81', '50|82', '50|83', '50|84', '50|85', '50|86', '50|87',
      '50|89', '50|90', '50|91', '50|92', '50|93',
      '50|97', '50|98', '50|99',
      '50|106', '50|107', '50|108', '50|109', '50|110', '50|111', '50|112',
      '50|114', '50|115', '50|116', '50|117', '50|118'
    ]
  }
];